﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp7
{
   public class Cock
    {
        private string name;
            public Cock(string name)
        {
            this.name=name;
            Sun.OnRise += new EventHandler(Sun_OnRise);
        }
        private void Sun_OnRise(object sender,EventArgs e)
        {
            Console.WriteLine("公鸡{0}：",name);
            Console.WriteLine("雄鸡一叫天下白", name);
            this.Sing();

        }
        public event EventHandler OnSing;
        public void Sing()
        {
            Console.WriteLine("喔喔喔...");
            if (OnSing != null)
            {
                OnSing(this, null);
            }
        }
    }
}
